package com.biboheart.adapter.express.support;

import com.biboheart.adapter.express.operation.Calculate;
import com.biboheart.adapter.support.utils.ObjectTypeUtils;

final class BitAndCalculate implements Calculate<Number, Number, Number> {
    @Override
    public Number calc(Number left, Number right) {
        if (null == left) {
            left = 0;
        }
        if (null == right) {
            return 0;
        }
        if ((left instanceof Long) || (right instanceof Long)) {
            return ObjectTypeUtils.convertType(left, Long.class) & ObjectTypeUtils.convertType(right, Long.class);
        }
        return ObjectTypeUtils.convertType(left, Integer.class) & ObjectTypeUtils.convertType(right, Integer.class);
    }

    @Override
    public Number calc(Number num) {
        return null;
    }
}
